package com.drm.netschool.mapper;

import com.drm.netschool.entity.DrmStudyCourse;
import com.drm.netschool.entity.DrmStudyCourseExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface DrmStudyCourseMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    int countByExample(DrmStudyCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    int deleteByExample(DrmStudyCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    @Delete({
        "delete from drm_study_course",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    @Insert({
        "insert into drm_study_course (id, course_id, ",
        "user_id, study_cnt, ",
        "study_time, can_study, ",
        "progress, laststudy_dt, ",
        "create_time, remark)",
        "values (#{id,jdbcType=BIGINT}, #{courseId,jdbcType=BIGINT}, ",
        "#{userId,jdbcType=BIGINT}, #{studyCnt,jdbcType=INTEGER}, ",
        "#{studyTime,jdbcType=INTEGER}, #{canStudy,jdbcType=INTEGER}, ",
        "#{progress,jdbcType=INTEGER}, #{laststudyDt,jdbcType=TIMESTAMP}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR})"
    })
    int insert(DrmStudyCourse record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    int insertSelective(DrmStudyCourse record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    List<DrmStudyCourse> selectByExample(DrmStudyCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    @Select({
        "select",
        "id, course_id, user_id, study_cnt, study_time, can_study, progress, laststudy_dt, ",
        "create_time, remark",
        "from drm_study_course",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    DrmStudyCourse selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    int updateByExampleSelective(@Param("record") DrmStudyCourse record, @Param("example") DrmStudyCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    int updateByExample(@Param("record") DrmStudyCourse record, @Param("example") DrmStudyCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    int updateByPrimaryKeySelective(DrmStudyCourse record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_study_course
     *
     * @mbggenerated Mon Sep 07 01:49:26 CST 2015
     */
    @Update({
        "update drm_study_course",
        "set course_id = #{courseId,jdbcType=BIGINT},",
          "user_id = #{userId,jdbcType=BIGINT},",
          "study_cnt = #{studyCnt,jdbcType=INTEGER},",
          "study_time = #{studyTime,jdbcType=INTEGER},",
          "can_study = #{canStudy,jdbcType=INTEGER},",
          "progress = #{progress,jdbcType=INTEGER},",
          "laststudy_dt = #{laststudyDt,jdbcType=TIMESTAMP},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "remark = #{remark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(DrmStudyCourse record);
}